Page({
  data: {
    width:0,              // 设备宽度
    margin:0,             // 回收值  
    markers: [],
    polyline: [{
      points: [{
        longitude: 112.949932,
        latitude: 28.258919
      }, {
        longitude: 111.46895,
        latitude: 27.260564
      }],
      color: "#FF0000DD",
      width: 2,
      dottedLine: false
    }],
    status_list: ["派送中", "已揽件"],
    // controls: [{
    //   id: 1,
    //   iconPath: '/img/location.png',
    //   position: {
    //     left: 0,
    //     top: 300 - 50,
    //     width: 50,
    //     height: 50
    //   },
    //   clickable: true
    // }]
    longitude: "111.74427",
    latitude: "27.258987",
    detailInfo: null,
    make_time: 0
  },
  regionchange(e) {
    console.log(e.type)
  },
  markertap(e) {
    console.log(e.detail.markerId)
  },
  controltap(e) {
    console.log(e.detail.controlId)
  },
  onLoad: function(options) {
    let self = this, width = wx.getStorageSync('SystemInfo')['windowWidth'],data={};
    // 获取设备信息
    data.width=width-60;
    data.margin=data.width/2;
    console.log(data,'ssssssssss')
    self.setData(data)

    // wx.getLocation({
    //   success: function(res) {
    //     console.log("位置", res)
    //     let {
    //       latitude,
    //       longitude
    //     } = res || {};
    //     self.setData({
    //       latitude,
    //       longitude
    //     })
    //   },
    // })

    wx.$api.getDetailLogistics({
      logistics_id: options.id
    }).then(res=>{
      if(res.data.code==200){
        let {map}=res.data.data || {};
        console.log(map)
        this.setData({
          detailInfo: res.data.data,
          make_time: wx.timestamp(res.data.data.make_time*1000),
          markers: map.markers,
          polyline: map.polyline
        })
      }
    })
  }
})